home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Varsity Update 1998 August
/
SGI Varsity Update 1998 August.iso
/
dist
/
dist6.5
/
il_dev.idb
/
usr
/
include
/
il
/
ilHwPass.h.z
/
ilHwPass.h
Wrap
C/C++ Source or Header
|
1998-07-29
|
9KB
|
241 lines
#if 0
Copyright (c) 1994 SGI All Rights Reserved
THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI
The copyright notice above does not evidence any
actual or intended publication of such source code,
and is an unpublished work by Silicon Graphics, Inc.
This material contains CONFIDENTIAL INFORMATION that
is the property of Silicon Graphics, Inc. Any use,
duplication or disclosure not specifically authorized
by Silicon Graphics is strictly prohibited.
RESTRICTED RIGHTS LEGEND:
Use, duplication or disclosure by the Government is
subject to restrictions as set forth in subdivision
(c)(1)(ii) of the Rights in Technical Data and Computer
Software clause at DFARS 52.227-7013, and/or in similar
or successor clauses in the FAR, DOD or NASA FAR
Supplement. Unpublished- rights reserved under the
Copyright Laws of the United States. Contractor is
SILICON GRAPHICS, INC., 2011 N. Shoreline Blvd.,
Mountain View, CA 94039-7311
#endif
/*
*/
#ifndef _ilHwPass_h_
#define _ilHwPass_h_
#include <il/ilLink.h>
#include <il/ilHwImg.h>
#include <il/ilFrameBufferImg.h>
#include <ifl/iflClassList.h>
class ilNopImg;
// OpenGL color description for fill area
struct ilHwFillDesc {
GLubyte rgb[4]; // r,g,b fill value for parent image
int ci; // ci fill value for parent image
void invert()
{
rgb[0] = ~rgb[0];
rgb[1] = ~rgb[1];
rgb[2] = ~rgb[2];
rgb[3] = ~rgb[3];
}
void negate()
{
rgb[0] = 255-rgb[0];
rgb[1] = 255-rgb[1];
rgb[2] = 255-rgb[2];
rgb[3] = 255-rgb[3];
}
void set(int isRgb=TRUE) const
{
if (isRgb)
glColor4ubv(rgb);
else
glIndexi(ci);
}
};
// ilHwPass encodes the hardware acceleration for an ilImage (or an
// ilImgStat). A table of ilHwPass instances, one per ilHwConnection/visual
// type combination (encoded via ilHwTarget), is hung off of each ilImage via
// ilImage::hwPassTable (or ilImgStat::hwPassTable). The ilHwPass associated
// with a particular ilHwTarget is retrieved via ilImage::hwGetPass()
// (or ilImgStat::hwGetPass()). Calls to hwGetPass() cause ilHwPass's to be
// created and cached if they don't exist yet.
//
// N.B. The API for ilImgStat::getPass() does not include an
// ilHwconnection specification. As such only one ilHwConnection
// will ever be in an ilImgStat's hwPassTable. Some thought is
// being given to this situation.
//
// An ilHwPass stores pointers to the ilHwTarget it is for (target),
// its source of image data (inImg), which ilImage (or ilImgStat)
// it's a pass for (via its ilLink parent), and the last ilImage in the
// pass chain (parentImg). The ilLink parent and parentImg are the same
// for ilImage's. For ilImgStat's, the ilLink parent points at the
// ilImgStat and parentImg points at the ilImgStat's source ilImage.
//
class ilHwPass : public ilLink {
public:
iflClassListDeclare
ilHwPass(ilLink* parent, const ilHwTarget& target);
virtual ~ilHwPass();
// Setup this ilHwPass for a particular operation, the 'inputIdx'
// selects which input to use as 'inImg' for polyadic operators,
// the pass with input index zero is the master and has a list
// of passes for the remaining inputs; it creates and owns the
// remaining passes, calling setup, with an appropriate input index,
// on each of those passes.
//
void setup(const ilHwOp& op, int inputIdx=0);
// Query to see if this pass need to be setup
//
int needsSetup() { resetCheck(); return setupNeeded; }
// Draw pass's parent image tile (x,y,z, nx,ny,1) at framebuffer
// location (fx,fy) (all coordinates are in the framebuffer image's
// orientation (lowerleft, etc.) unless overridden by the config
// cfg).
//
virtual ilStatus drawTile(ilMpNode* parent,
float x, float y, float z, int nx, int ny,
ilHwImg* hwImg, int fx, int fy,
int buffEnables=0, ilHwHintList* hints=NULL,
ilMpManager** pMgr=NULL);
// Read pass's parent image tile (x,y,z, nx,ny,nz) and place in
// buffer with coordinates (dx,dy,dz, dnx,dny,dnz). The attributes
// are determined by the parent image unless overridden by config.
//
virtual ilStatus readTile(ilMpNode* parent, int x, int y, int z,
int nx, int ny, int nz, void*& data,
int dx, int dy, int dz, int dnx, int dny, int dnz,
const ilConfig* cfg, ilMpManager** pMgr=NULL);
// Get statistics for specified channel. This assumes that a drawTile
// has been performed with ilHwOpStat selected.
//
virtual ilStatus getStat(unsigned long* hist, double& min, double& max,
int chan);
// Return target information associated with this pass: connection,
// visual class, target ID, whether the pass is on RGB mode, etc.
//
ilHwConnection* getConnection() { return target.getConnection(); }
int getClass() { return target.getClass(); }
int getID() { return target.getID(); }
int isRgb() { return target.isRgb(); }
// Return parent/input image.
//
ilImage* getParentImg() { return parentImg; }
ilImage* getInput() { return inImg; }
// Return the last framebuffer image used with this pass
//
ilFrameBufferImg* getLastFbImg();
// Set RGB and color index fill values (calculated from parentImg's
// fill value).
//
void setFillColor() { fill.set(isRgb()); }
// return RGB fill value
//
const GLubyte* getRgbFill() const { return fill.rgb; }
// Chain on a "related" nop image using given related type
//
static ilNopImg* getNopImg(ilImage* img, int rtype);
// Chain on a "related" nop image using default related type (depricated)
//
static ilNopImg* getNopImg(ilImage* img);
protected:
// Check validity of an operation, called from setup after parent
// and input image are filled in, the input index is used to
// distinguish the 'master' pass (index 0) from the slave passes
// (index > 0).
//
virtual void checkOp(const ilHwOp& op, int inputIdx) = 0;
// Copy another hardware pass's parameters onto ourself. For this
// base class the only thing that needs to be copied is inImg.
void copy(ilHwPass* pass) { inImg = origInImg = pass->origInImg; }
// Update the last framebuffer image used with this pass
//
void updateLastFbImg(ilFrameBufferImg* fbImg);
// compute appropriate fill value (based on parent image and
// our visual).
//
void calcFill(ilHwFillDesc& fillDesc, ilImage* img, int transparent=FALSE);
// determine what the h/w supports on this visual
//
void calcCapabilities();
// returns TRUE if the input is a related image, but is not a color
// image that was allocated by ilOpImg. The pass cannot alter any
// image that can affect the application chain (including the pass'
// parent)
//
int canAlterInput(ilImage* input=NULL);
// Pixel operations (DrawPixel/SubtextureLoad) supported by hardware
// for the visual that we are using. These methods must not be called
// before calling calcCapabilites().
//
int doesRGB() { return capabilities & ilHwCapCvtRGB; }
int doesLuminance() { return capabilities & ilHwCapCvtLuminance; }
int doesScale() { return capabilities & ilHwCapScaleBias; }
int doesZoom() { return capabilities & ilHwCapZoom; }
int doesFracZoom() { return capabilities & ilHwCapFracZoom; }
int doesTexture() { return capabilities & ilHwCapTexture; }
int doesConvolve() { return capabilities & ilHwCapConvolve; }
int doesBlendColor() { return capabilities & ilHwCapBlendColor; }
int doesBlendLogicOp() { return capabilities & ilHwCapBlendLogicOp; }
int doesColorMatrix() { return capabilities & ilHwCapColorMatrix; }
// reset just sets the setupNeeded flag
virtual void reset();
ilHwTarget target; // target for this pass (dpy/visual)
ilImage* parentImg; // parent image, last element in pass's chain
ilImage* inImg; // input image, first element in pass's chain
ilImage* origInImg; // input image before any converters are applied
ilHwFillDesc fill; // parent image fill descriptor
int capabilities; // capabilities for pass (a modified copy of the
// related ilHwConnection's "capability" with
// modifications based on target's visualClass)
int setupNeeded; // if TRUE, pass needs to be setup
};
inline int
ilHwCanAlter(ilImage* input)
{
extern iflName* ilInheritColorConvID;
return input->isRelated() &&
(!input->isColorImg() || ilInheritColorConvID == NULL ||
!input->getProp(ilInheritColorConvID));
}
#endif